<%--
  Created by IntelliJ IDEA.
  User: asus
  Date: 2017/6/18
  Time: 11:27
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>登录页</title>
    <style>
        #msg{
            color: red;
        }
    </style>
</head>
<body>
    <center>
            <div id="msg"></div>
            username:<input type="text" id="username"/>
            <br><br>
            password:<input type="password" id="pwd"/>
            <br><br>
            <button  id="btn">111</button>

    </center>
    <script type="text/javascript" src="${pageContext.request.contextPath}/easyui/jquery.min.js"></script>
</body>
<script>
    $('#btn').click(function () {
        alert("aa");
        $.ajax({
            type: "post",
            url: "login_t",
            data: {
                "username": $.trim($('#username').val()),
                "pwd": $.trim($('#pwd').val())
            },
            dataType: "json",
            success: function (r) {                    //r为返回值
                console.log(r);
                console.log(r.status);
                if (r.status == "200") {              //y为 url跳转网页中传回的值。
                    window.location.href = "${pageContext.request.contextPath}/details";
                } else {
                    $('#msg').text(r.message);
                }
            }
        })
    });

</script>
</html>
